<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			form{
				width: 100%;
				display: block;
				text-align: center;
				margin-top: 200px;
				background: #DDDDDD;
			}
			.fileBox{
				width: 300px;
				height: 50px;
				margin: 0 auto;
				position: relative;
				background: #fff;
			}
			input#weixin2weima{
				opacity: 0;
				position: absolute;
				z-index: 1;
				background: #000066;
				height: 100%;
				width: 100%;
				left: 0;
				top:0;
			}
			input#text{
				position: absolute;
				left: 0;
				top: 0;
				width: 276px;
				height: 44px;
				color: #000;
				font-size: 28px;
				padding: 1px 10px;
			}
		</style>
	</head>
	<body>
		<form>
			<div class="fileBox">
				<input type="file" name="wechatCode" id="weixin2weima" onchange="weixinfile()" />
				<input id="text" type="text" placeholder="点击上传文件">
			</div>
		</form>
		<script type="text/javascript">
			var $weixin2weima = document.querySelector("#weixin2weima"),
				$text = document.querySelector("input#text");
			var weixinfile= function() {
				$text.value = $weixin2weima.files[0].name
			}
		</script>
	</body>
</html>
